<template>
  <!-- 游戏运营商管理 -->
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" :inline="true" class="search-form-new" label-width="auto">
      <!-- <el-form-item label="手机号" prop="tel">
        <el-input v-model="queryParams.tel" placeholder="请输入手机号" clearable size="small" />
      </el-form-item>
      <el-form-item label="卡位编号" prop="num">
        <el-input v-model="queryParams.num" placeholder="请输入编号" clearable size="small" />
      </el-form-item> -->
      <el-form-item class="btns">
        <!-- <el-button type="primary" icon="el-icon-search" @click="search">搜索</el-button>
        <el-button type="warning" icon="el-icon-refresh" @click="resetQuery">重置</el-button> -->
        <el-button type="success" icon="el-icon-plus" @click="openAdd">新增</el-button>
      </el-form-item>
    </el-form>
    <div class="table_box">
      <el-table :data="tableData.records" border stripe>
        <el-table-column prop="name" label="运营商名称" ></el-table-column>
        <!-- <el-table-column prop="shouCost" label="收短信虞豆数" width="150"></el-table-column>
        <el-table-column prop="faCost" label="发短信虞豆数" width="150"></el-table-column> -->
        <el-table-column prop="remark" label="备注" ></el-table-column>
        <el-table-column fixed="right" label="操作" width="300">
          <template slot-scope="scope">
            <el-button type="edit" @click="editRow(scope.row)">编辑</el-button>
            <el-button type="text" @click="setNumbers(scope.row)">设置号码</el-button>
            <el-button type="text" @click="setSigns(scope.row)">设置短信签名</el-button>
          </template>
        </el-table-column>
      </el-table>
      <pagination v-show="tableData.total > 0" :total="tableData.total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />

    </div>

    <addDialog ref="addDialog"></addDialog>
    <numbersSetDialog ref="numbersSetDialog"></numbersSetDialog>
    <signsSetDialog ref="signsSetDialog"></signsSetDialog>
  </div>
</template>

<script>
import addDialog from "./add";
import numbersSetDialog from "./numbersSetDialog";
import signsSetDialog from "./signsSetDialog";
import gameListApi from "@/api/gameConfig/gameList";
export default {
  name: "Gameyunyingshang",
  components: { addDialog ,numbersSetDialog,signsSetDialog},
  data() {
    return {
      dialogVisiblese: false,
      tableData: {
        records: [],
        total: 0,
      },
      loading: false,
      queryParams: {
        pageNum: 1,
        pageSize: 20,
      },
    };
  },
  created() {
    this.getList();
  },
  activated() {},
  methods: {
    // 获取列表
    getList() {
      this.loading = true;
      gameListApi.getGameYunyingshangList(this.queryParams).then((response) => {
        this.tableData.records = response.rows;
        this.tableData.total = response.total;
        this.loading = false;
        if (response.rows && response.rows.length) {
          this.rise = response.rows[0].rise;
        }
      });
    },
    // 搜索
    search() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
 
    // 打开新增弹窗
    openAdd() {
      this.$refs.addDialog.open();
    },
    // 打开编辑弹窗
    editRow(row) {
      this.$refs.addDialog.open("edit", row);
    },
    // 打开设置号码的弹窗
    setNumbers(row){
      this.$refs.numbersSetDialog.open(row)
    },
    setSigns(row){
      this.$refs.signsSetDialog.open(row)
    },
  
    //重置
    resetQuery() {
      this.queryParams = {
        pageNum: 1,
        pageSize: 20,
      };
      this.getList();
    },
  },
};
</script>
<style lang="scss" scoped>

</style>